home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC Gamer (Italian) 30
/
PC Gamer IT CD 30 1-2.iso
/
MOTS
/
GAMEDATA
/
EPISODE
/
JKM_PCG.GOO
/
cog_s1l2_doorswitch.cog
< prev
next >
Wrap
Text File
|
1998-02-25
|
4KB
|
165 lines
# Jedi Knight Missions Cog Script
#
# S1L2_DOORSWITCH.COG
#
# [TL]
#
# (C) 1997 LucasArts Entertainment Co. All Rights Reserved
#
#==========================================================
symbols
thing door0 linkid=1
thing sparkspot nolink
thing player local nolink
surface adjoin0 linkid=2
surface adjoin1 linkid=3
surface panel mask=0x008 linkid=4
surface button mask=0x008
sound alarm
sound sparksound
sound kyle
sound kylelocked
sound wav0=lvrclik2.wav
sector sector0 linkid=5
sector sector1 linkid=5
sector sector2 linkid=5
sector sector3 linkid=5
sector sector4 linkid=5
sector sector5 linkid=5
sector sector6 linkid=5
sector sector7 linkid=5
sector sector8 linkid=5
sector sector9 linkid=5
template spark=+sparks local
int doorsector local
int soundnum0 local
int soundnum1 local
int soundnum2 local
int burn=0 local
int alarmon=0 local
int done=0 local
flex minimumDelay=2.0
flex maximumDelay=4.0
flex nextSpark=0.5 local
message startup
message crossed
message timer
message damaged
message activated
end
# ===================================================
code
startup:
MoveToFrame(door0, 1, 8);
doorsector = GetThingSector(door0);
SectorAdjoins(doorsector, 1);
SectorLight(doorsector, 1.0, 0.0);
player=GetLocalPlayerThing();
return;
#....................................................
activated:
if (GetCurFrame(door0) == 1) return;
if (GetSenderId() == 1)
{
if (done == 0)
{
done=1;
SendMessageEx(GetMasterCOG(), user0, 1, 0, 0, 0);
sleep(0.25);
PlaySoundLocal(wav0, 1, 0, 0);
sleep(0.25);
PlaySoundLocal(kylelocked, 1, 0, 0);
}
else if (done == 1)
{
PlaySoundLocal(wav0, 1, 0, 0);
sleep(0.25);
PlaySoundLocal(kylelocked, 1, 0, 0);
}
}
return;
crossed:
if (burn) return;
if ((GetSenderId() == 2) && (alarmon == 0))
{
soundnum0=PlaySoundLocal(alarm, 1, 0, 1);
MoveToFrame(door0, 0, 4);
SectorAdjoins(doorsector, 0);
alarmon=1;
}
if ((GetSenderId() == 3) && (alarmon == 1))
{
SetTimerEx(2, 0, 0, 0);
}
return;
#....................................................
timer:
if (GetSenderID() == 0)
{
if (GetThingSector(player) == sector0) return;
if (GetThingSector(player) == sector1) return;
if (GetThingSector(player) == sector2) return;
if (GetThingSector(player) == sector3) return;
if (GetThingSector(player) == sector4) return;
if (GetThingSector(player) == sector5) return;
if (GetThingSector(player) == sector6) return;
if (GetThingSector(player) == sector7) return;
if (GetThingSector(player) == sector8) return;
if (GetThingSector(player) == sector9) return;
MoveToFrame(door0, 1, 4);
SectorAdjoins(doorsector, 1);
StopSound(soundnum0, 0);
alarmon=0;
}
else
if (GetSenderID() == 1)
{
CreateThing(spark, sparkspot);
soundnum1=PlaySoundThing(sparksound, sparkspot, 1, -1, -1, 0);
nextSpark = minimumDelay + (Rand() * (maximumDelay - minimumDelay));
SetTimerEx(nextSpark, 1, 0, 0);
}
return;
#....................................................
damaged:
if (burn) return;
if (((GetSenderRef() == panel) || (GetSenderRef() == button)) && (alarmon == 0))
{
burn=1;
SendMessageEx(GetMasterCOG(), user0, 2, 0, 0, 0);
SetTimerEx(nextspark, 1, 0, 0);
SetWallCel(button, 1);
SetWallCel(panel, 1);
sleep(1.5);
soundnum2=PlaySoundLocal(kyle, 1, 0, 0);
jkPrintUNIString(-1, 60009);
}
return;
end